<?php
    
  $aux = explode ( '|', isset($_GET['id']) ? $_GET['id'] : '' );
  $JobUid = str_replace ( '"', '', $aux[0] );
  
  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrJobs.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrJobsPeer::retrieveByPK( $JobUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrJobs' ) ) { 
     $fields['JOB_UID'] = $tr->getJobUid();
     $fields['EMPLOYEE_ID'] = $tr->getEmployeeId();
     $fields['POSITION_ID'] = $tr->getPositionId();
     $fields['BOARDHIREDATE'] = $tr->getBoardhiredate();
     $fields['TYPEOFAPPOINTMENT_ID'] = $tr->getTypeofappointmentId();
     $fields['TYPEEMPLOYEE_ID'] = $tr->getTypeEmployeeId();
     $fields['JOBTITLE_ID'] = $tr->getJobtitleId();
     $fields['TYPEPAY_ID'] = $tr->getTypepayId();
//     $fields['ANNUALSALARY'] = $tr->getAnnualsalary();
     $fields['FTE'] = $tr->getFte();
     $fields['PRIMARYIRN'] = $tr->getPrimaryIrn();
//     $fields['HOURLYRATE'] = $tr->getHourlyrate();
     $fields['SPREADPAY'] = $tr->getSpreadpay();
//     $fields['NUMBEROFWORKDAYS'] = $tr->getNumberofworkdays();
     $fields['OTHERPAY'] = $tr->getOtherpay();
     $fields['LOCATIONIRN'] = $tr->getLocationirn();
     $fields['JOBASSIGNMENT'] = $tr->getJobassignment();
     $fields['JOBSTATUS_ID'] = $tr->getJobstatusId();
     $fields['TERMINATIONDATE'] = $tr->getTerminationdate();
     $fields['PROJECTTERMINATIONDATE'] = $tr->getProjectterminationdate();
     $fields['PAYUNIT_ID'] = $tr->getPayunitId();
     $fields['UNITAMOUNT'] = $tr->getUnitamount();
     $fields['PAYPLAN_ID'] = $tr->getPayplanId();
     $fields['HOURSINDAY'] = $tr->getHoursinday();
     $fields['DAYSINPERIOD'] = $tr->getDaysinperiod();
     $fields['NUMBEROFPAYS'] = $tr->getNumberofpays();
//     $fields['BUILDINGPERCENT'] = $tr->getBuildingpercent();
     $fields['FUNCTIONS'] = $tr->getFunctions();
     $fields['FUND'] = $tr->getFund();
     $fields['OBJECT'] = $tr->getObject();
     $fields['OPU'] = $tr->getOpu();
     $fields['SPECIALCOSTCENTER'] = $tr->getSpecialcostcenter();
     $fields['SUBJECT'] = $tr->getSubject();
     $fields['FUNDSOURCECODE1'] = $tr->getFundsourcecode1();
     $fields['FUNDSOURCECODE1P'] = $tr->getFundsourcecode1p();
     $fields['FUNDSOURCECODE2'] = $tr->getFundsourcecode2();
     $fields['FUNDSOURCECODE2P'] = $tr->getFundsourcecode2p();
     $fields['FUNDSOURCECODE3'] = $tr->getFundsourcecode3();
     $fields['FUNDSOURCECODE3P'] = $tr->getFundsourcecode3p();
     $fields['INSTRUCTIONALLEVEL'] = $tr->getInstructionallevel();
  }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'processmaker';
  $G_SUB_MENU = 'hr/menuhrEmployee';
  $G_ID_MENU_SELECTED = 'ID_HR_EMP';
  $G_ID_SUB_MENU_SELECTED = 'ID_HR_JOBS';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrJobsEdit', '', $fields, 'hrJobsSave' );
  G::RenderPage('publish', 'blank');   
?>